<template>
	<div>
		<el-form ref="form" :model="form" label-width="100px">



			<el-form-item label="姓名" prop="customerName">
				<el-input v-model="form.customerName"></el-input>
			</el-form-item>


			<el-form-item label="性别" prop="customerSex">
				<el-input v-model="form.customerSex"></el-input>
			</el-form-item>
			<el-form-item label="年龄" prop="customerAge">
				<el-input v-model="form.customerAge"></el-input>
			</el-form-item>
			<el-form-item label="身心状况" prop="psychologicalStatus">
				<el-input v-model="form.psychologicalStatus"></el-input>
			</el-form-item>
			<el-form-item label="既往病史" prop="customerAnamnesis">
				<el-input v-model="form.customerAnamnesis"></el-input>
			</el-form-item>
			<el-form-item label="注意事项" prop="matters">
				<el-input v-model="form.matters"></el-input>
			</el-form-item>
		

			<el-form-item>
				<el-button type="primary" @click="save">保存</el-button>
			</el-form-item>
		</el-form>

	</div>
</template>

<script>
	export default {
		customerName: 'DailyCareEdit',
		components: {

		},
		props: [
			'showEdit',
			'careId',
			'editid'
		],
		data() {
			return {
				form: {
					careId:'',
					customerName: '',
					customerSex: '',
					customerAge: '',
					psychologicalStatus: '',
					customerAnamnesis: '',
					matters: ''
				},
				// supdate: false,
				url: '/dailyCare/save',
				registerlevel: [],
				depts: [],
			}
		},
		created() {
			// this.init()
			console.log("this.editid:" + this.editid)
			if (this.editid) {
				this.axios.get('/dailyCare/toedit', response => {
					console.log(response.obj);
					this.form=response.obj
					
					
		
					
				}, {
					id: this.editid
				})
			}
		},
		methods: {
			save() {
				this.$refs['form'].validate((valid) => {
					if (valid) {
						this.axios.post(this.url, response => {
							// 子组件要改变父组件的值
							this.$emit('update:show', false)
							this.$emit('getData')
						}, this.form)
					}
				})
			}

		}
	}
</script>

<style>
</style>
